﻿<%@ Page Title="家乐福——我要参赛" Language="C#" MasterPageFile="~/MasterPageNavStepTwoCol.master"
    AutoEventWireup="true" CodeBehind="SubmitInfo.aspx.cs" Inherits="WebSite.SubmitInfo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        div.TextButton
        {
            height: 30px;
            width: 190px;
            background: url(images/SubmitInfo/ButtonText.png) no-repeat;
            vertical-align: middle;
            text-align: center;
            display: inline-block;
            padding-top: 5px;
            font-size: 14px;
        }
        
        .twolinetext
        {
            width: 60px;
            display: inline-block;
        }
        
        .twolinestar
        {
            display: inline-block;
            line-height: 30px;
            height: 30px;
            vertical-align: top;
        }
    </style>
    <style type="text/css">
        div.InfoRow div.p1
        {
            float: left;
            width: 10px;
            color: Red;
            padding: 2px;
            display: inline-block;
        }
        div.InfoRow div.p2
        {
            display: inline-block;
            width: 60px;
            padding: 2px;
            float: left;
            margin-right: 5px;
        }
        
        div.InfoRow div.p3
        {
            display: inline-block;
            float: left;
        }
    </style>
    <script type="text/javascript" src="/js/PCASClass.js"></script>
    <script src="js/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
    <link href="js/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <link href="js/jquery.colorbox/colorbox.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
    <link href="css/ImageUploadCut.css" rel="stylesheet" type="text/css" />
    <script src="js/ImageUploadCut.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="Yahei" style="font-size: 18px; color: #da9411; font-weight: bold">
        &nbsp;&nbsp;标 * 均为必填项</div>
    <div style="margin: 5px 0 10px 0">
        &nbsp;&nbsp;&nbsp;您的资料（请如实填写监护人姓名，以便发送奖品）</div>
    <div style="height: 5px; width: 670px; background: url(images/separline.png) no-repeat;
        margin: 5px auto;">
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            宝宝姓名：</div>
        <div class="p3">
            <input type="text" class="Textbox" runat="server" maxlength="4" id="tbBabyName" />
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            生&nbsp;&nbsp;&nbsp;&nbsp;日：</div>
        <div class="p3">
            <select class="Select" runat="server" id="selectBirthdayYear">
                <option>2012</option>
                <option>2011</option>
                <option>2010</option>
                <option>2009</option>
            </select>
            <select class="Select" runat="server" id="selectBirthdayMonth">
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
                <option>11</option>
                <option>12</option>
            </select>
            <select class="Select" runat="server" id="selectBirthdayDay">
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
                <option>11</option>
                <option>12</option>
                <option>13</option>
                <option>14</option>
                <option>15</option>
                <option>16</option>
                <option>17</option>
                <option>18</option>
                <option>19</option>
                <option>20</option>
                <option>21</option>
                <option>22</option>
                <option>23</option>
                <option>24</option>
                <option>25</option>
                <option>26</option>
                <option>27</option>
                <option>28</option>
                <option>29</option>
                <option>30</option>
                <option>31</option>
            </select>
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            性&nbsp;&nbsp;&nbsp;&nbsp;别：</div>
        <div class="p3">
            <input runat="server" checked="true" id="rbSexMale" type="radio" />&nbsp;男&nbsp;<input
                type="radio" runat="server" id="rbSexFemale" />&nbsp;女
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
        </div>
        <div class="p2">
            体&nbsp;&nbsp;&nbsp;&nbsp;重：</div>
        <div class="p3">
            <input runat="server" id="tbWeight" type="text" class="Textbox" />
            kg
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
        </div>
        <div class="p2">
            身&nbsp;&nbsp;&nbsp;&nbsp;高：</div>
        <div class="p3">
            <input runat="server" id="tbHeight" type="text" class="Textbox" />
            cm
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            宝宝介绍：</div>
        <div class="p3">
            <div>
                <textarea runat="server" id="tbIntro" rows="6" style="width: 450px" class="Textbox"></textarea></div>
            <div>
                活动期间个人照片及资料均不可修改，宝宝介绍请控制在200字以内
            </div>
            <div class="Star">
                *为确保中奖后及时联系到您，请确认所有信息真实有效。
            </div>
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            宝宝常用奶粉品牌：</div>
        <div class="p3">
            <select runat="server" id="selectMilkBrand" class="Select">
                <option>贝因美</option>
                <option>美素</option>
                <option>惠氏</option>
                <option>雀巢</option>
                <option>雅培</option>
                <option>美赞臣</option>
                <option>多美滋</option>
                <option>明治</option>
                <option>澳优</option>
                <option>亨氏</option>
                <option>明一</option>
                <option>雅士利</option>
                <option>蒙牛</option>
                <option>光明培尔贝瑞</option>
                <option>旭贝尔</option>
                <option>伊利</option>
                <option>可瑞康</option>
                <option>康贝加</option>
                <option>特福芬</option>
                <option>百立乐</option>
                <option>其他</option>
            </select>
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            监护人姓名：</div>
        <div class="p3">
            <input type="text" runat="server" id="tbParentFirstName" class="Textbox" /><input
                type="text" runat="server" id="tbParentLastName" class="Textbox" style="display: none" />
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">
            *</div>
        <div class="p2">
            与宝宝的关系：</div>
        <div class="p3">
            <input type="text" class="Textbox" runat="server" visible="false" id="tbParentType" />
            <select runat="server" id="selectParentType">
                <option value="2">父亲</option>
                <option value="1">母亲</option>
                <option value="3">伯伯/叔叔</option>
                <option value="4">伯母/阿姨</option>
                <option value="99">其他</option>
            </select>
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow" id="procityarea">
        <div class="p1">
            *</div>
        <div class="p2">
            居住地址：</div>
        <div class="p3">
            <select class="Select" id="selectProvince" name="selectProvince" style="width: 80px;">
        </select>
        <select class="Select" id="selectCity" name="selectCity" style="width: 80px;">
        </select>
        <select class="Select" id="selectArea" name="selectArea" style="width: 80px;">
        </select>
        <input type="text" runat="server" id="tbAddress" class="Textbox" style="width: 180px" />
        </div>
        <div class="clearfloat">
        </div>
    </div>
    <div class="InfoRow">
        <div class="p1">*</div>
        <div class="p2">邮&nbsp;&nbsp;&nbsp;&nbsp;编：</div>
        <div class="p3">
            <input type="text" runat="server" id="tbPostCode" class="Textbox" maxlength="6" style="width: 60px" />
        </div>
        <div class="clearfloat"></div>
    </div>
    <div class="InfoRow">
        <div class="p1">*</div>
        <div class="p2">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</div>
        <div class="p3">
            <div>
            <input runat="server" id="tbEmail" type="text" class="Textbox" /></div>
            <div>请填写常用邮箱，便于及时联系</div>
        </div>
        <div class="clearfloat"></div>
    </div>
    <div class="InfoRow" >
        <div class="p1">*</div>
        <div class="p2">宝宝头像：</div>
        <div class="p3">
            <div class="uploadimageregion">
                <div class="imgregion">
                    <img id="imgHead" class="uploadimagehidden" src="" width="300px" height="300px" alt="" />
                    <input type="hidden" id="hdHeadImage" name="hdHeadImage" />
                </div>
                <div class="uploadbuttonregion">
                    <input id="uploadHeadImageFile" type="file" />
                </div>
                <div class="extremark">
                    *该照片将作为您的头像照片进行展示</div>
            </div>
        </div>
        <div class="clearfloat"></div>
    </div>
   <div class="InfoRow">
        <div class="p1"></div>
        <div class="p2">生活照&nbsp;1：</div>
        <div class="p3">
            <div class="uploadimageregion">
                <div class="imgregion">
                    <img id="imgLive1" class="uploadimagehidden" src="" width="300px" height="300px"
                        alt="" />
                    <input type="hidden" id="hdLiveImage1" name="hdLiveImage1" />
                </div>
                <div class="uploadbuttonregion">
                    <input id="uploadLiveImageFile1" type="file" />
                </div>
            </div>
        </div>
        <div class="clearfloat"></div>
    </div>
    <div class="InfoRow">
        <div class="p1"></div>
        <div class="p2">生活照&nbsp;2：</div>
        <div class="p3">
            <div class="uploadimageregion">
                <div class="imgregion">
                    <img id="imgLive2" class="uploadimagehidden" src="" width="300px" height="300px"
                        alt="" />
                    <input type="hidden" id="hdLiveImage2" name="hdLiveImage2" />
                </div>
                <div class="uploadbuttonregion">
                    <input id="uploadLiveImageFile2" type="file" />
                </div>
            </div>
        </div>
        <div class="clearfloat"></div>
    </div>

    <div class="InfoRow">
        <div class="p1">*</div>
        <div class="p2">我的宝宝帮名称：</div>
        <div class="p3">
            <div>
            <input type="text" runat="server" id="tbTeamName" class="Textbox" /></div>
            <div class="Star">如果您向别的宝宝发起组队邀请并被接受，你们的宝宝帮将采用您现在填写的参赛名称及宣言</div>
        </div>
        <div class="clearfloat"></div>
    </div>

    <div class="InfoRow">
        <div class="p1">*</div>
        <div class="p2">参赛宣言：</div>
        <div class="p3">
        <textarea runat="server" id="tbTeamDeclaration" rows="6" style="width: 450px" class="Textbox"></textarea>
        </div>
        <div class="clearfloat"></div>
    </div>

    <div class="InfoRow">
        <div class="p1">*</div>
        <div class="p2">验 证 码：</div>
        <div class="p3">
            <input runat="server" id="tbvcode" type="text" style="width: 60px" class="Textbox" />
        <img id="imgVCode" alt="Check code" src="" onclick="javascript:$('#imgVCode').attr('src','/vCode.ashx?r=' + Math.random());" />
        </div>
        <div class="clearfloat"></div>
    </div>


    <div class="InfoRow" style="margin-top: 20px">
        <div style="text-align: center">
            <input type="checkbox" class="CheckBox" id="chbRule" />
            我已阅读并同意<span style=""><a target="_blank" style="color: green" href="/Rule.aspx">《参赛须知》</a></span>
        </div>
        <div style="text-align: center; margin-top: 10px">
            <asp:ImageButton runat="server" ImageUrl="images/SubmitInfo/ButtonSubmit.png" ID="ibSave"
                OnClick="ibSave_Click" OnClientClick="return checkform();" />
        </div>
    </div>
    <script type="text/javascript">
        function callbackUploadHead(url ) 
        { 
            setUploadImageResult( $("#imgHead"), $("#hdHeadImage"), url); 
            $.fn.colorbox.close(); 
        } 

        function callbackUploadLiveImage1(url ) 
        { 
            setUploadImageResult( $("#imgLive1"), $("#hdLiveImage1"), url); 
            $.fn.colorbox.close(); 
        } 

        function callbackUploadLiveImage2(url ) 
        { 
            setUploadImageResult( $("#imgLive2"), $("#hdLiveImage2"), url); 
            $.fn.colorbox.close(); 
        } 
        
        $(document).ready(function() 
        { 
            // 省市 
            <% if( currentBabyInfo == null ) 
            { 
            %> 
                new PCAS("selectProvince", "selectCity", "selectArea", "上海市", "", ""); 
            <% 
            } 
            else 
            { 
            %> 
                new PCAS("selectProvince", "selectCity", "selectArea", "<%= currentBabyInfo.LiveProvince %>", "<%= currentBabyInfo.LiveCity %>", "<%= currentBabyInfo.LiveArea %>");
                setUploadImageResult( $("#imgHead"), $("#hdHeadImage"), '<%=currentBabyInfo.BabyHeadImg %>'); 
                setUploadImageResult( $("#imgLive1"), $("#hdLiveImage1"), '<%=currentBabyLiveImage1 %>'); 
                setUploadImageResult( $("#imgLive2"), $("#hdLiveImage2"), '<%=currentBabyLiveImage2 %>'); 
            <% 
            }
            %> 
            // 头像
            

            $("#imgVCode").click(); 
            SetUploadify($("#uploadHeadImageFile"), "callbackUploadHead");
            SetUploadify($("#uploadLiveImageFile1"), "callbackUploadLiveImage1");
            SetUploadify($("#uploadLiveImageFile2"), "callbackUploadLiveImage2");
        }); 

        function isPostalCode(v)
        {
            var pattern =/^[0-9]{6}$/;
            
            return pattern.test(v);
        }

        function isEmail(v)
        {
            var pattern =/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
            
            return pattern.test(v);
        }
        
    
        function checkform() 
        {
            

            if ($("#<%= tbBabyName.ClientID %>").val() == "") { alert("请填写宝宝姓名"); return false; } 
            if( $("#<%=tbWeight.ClientID %>").val() != '' )
            {
                if(  isNaN(parseInt( $("#<%=tbWeight.ClientID %>").val() ) ) ) { alert("请填写体重（必须为整数）"); return false; }
            }
            if( $("#<%=tbHeight.ClientID %>").val() != '' )
            {
                if( isNaN(parseInt( $("#<%=tbHeight.ClientID %>").val() ) ) ) { alert("请填写身高（必须为整数）"); return false; }
            }
            if ($("#<%= tbIntro.ClientID %>").val() == "") { alert("请填写宝宝介绍"); return false; } 
            if ($("#<%= tbParentFirstName.ClientID %>").val() == "") { alert("请填写监护人姓名"); return false; } 
            // if ($("#<%= tbParentLastName.ClientID %>").val() == "") { alert("请填写监护人姓名"); return false; } 
            if ($("#<%= tbAddress.ClientID %>").val() == "") { alert("请填写地址"); return false; } 
            if ($("#<%= tbPostCode.ClientID %>").val() == "" || !isPostalCode( $("#<%= tbPostCode.ClientID %>").val() ) ) { alert("请填写邮编"); return false; } 
            if ($("#<%= tbEmail.ClientID %>").val() == "" || !isEmail($("#<%= tbEmail.ClientID %>").val())) { alert("邮箱格式填写不正确，请重新填写"); return false; } 
            if ($("#hdHeadImage").val() == "") { alert("请上传头像照片"); return false; } 
            if ($("#<%= tbTeamName.ClientID %>").val() == "") { alert("请填写宝宝帮名称"); return false; } 
            if ($("#<%= tbTeamDeclaration.ClientID %>").val() == "") { alert("请填写宝宝帮宣言"); return false; } 
            if ($("#<%= tbvcode.ClientID %>").val()=="") { alert("请填写验证码"); return false; } 
            if ($("#chbRule").attr("checked") != "checked") { alert("请阅读并同意参赛须知"); return false; } 
        
            return true; 
        }     
    </script>
</asp:Content>
